<template>
  <view class="container">
    <view class="info">
      <view class="title">{{ news.title }}</view>
      <view class="time">{{ news.publishTime }}</view>
      <rich-text class="text" :nodes="news.content" />
    </view>
  </view>
</template>

<script setup>
const news = ref({
  id: null,
  title: '',
  content: ''
});

onLoad((options) => {
  onNoticeInfo(options.id);
});

const onNoticeInfo = (noticeId) => {
  http
    .request({
      url: '/shop/notice/info/' + noticeId,
      method: 'GET'
    })
    .then(({ data }) => {
      data.content = data.content.replace(/width=/gi, 'sss=');
      data.content = data.content.replace(/height=/gi, 'sss=');
      data.content = data.content.replace(/ \/>/gi, ' style="max-width:100% !important;display:block;" />');
      news.value = data;
    });
};
</script>

<style scoped lang="scss">
@import './noticeDetail.scss';
</style>
